Menu

Wiki usage

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
Edit Sidebar
Main > FogThatPulsates

Fog that pulsates, tutorial

Most mappers know how to set the farplane distance and color, if not there are lots of tutorials on the subject... basically you just set:


 world farplane_color 0.3 0.3 0.3
 $world farplane 4000

...in your script an play around with the variables until you've got what you want.

This tutorial takes it a step further, into dynamically changing the farplane distance and color during gameplay. This is not really complicated: the hard part was to get the idea ( And I got it from MPowel1944? at .MAP ).

This example method pulsates the fog between purple and "poison yellow", and rolls it wildly back and forth... play with the variables at the start to calibrate it into someting that you can actually use:


 pulsating_fog:
   // Color settings
   local.farplane_color = "0.3 0.3 "
   local.blue = 0
   local.blue_max = 1
   local.blue_min = 0
   local.blue_step = 0.01
   // Depth settings
   local.fogplane = 5500
   local.fogplane_step = 40
   // Other stuff
   local.pulsate_speed = 0.1
   local.acending = 1
   // Actual code
   while ( 1 ) //for ever
   {
     // Switch pulse direction at max and min
     if(local.blue < local.blue_min || local.blue > local.blue_max)
     {
       local.acending = ! local.acending
     }
     wait local.pulsate_speed
     if(local.acending)
     {
       local.blue = local.blue + local.blue_step
       local.fogplane = local.fogplane + local.fogplane_step
     }
     else
     {
       local.blue = local.blue - local.blue_step
       local.fogplane = local.fogplane - local.fogplane_step
     }
     // Set the variables in $world
     $world farplane_color ( local.farplane_color + local.blue )
     $world farplane local.fogplane
   }
 end

Just put it in your script and put the line:


 thread pulsating_fog

...in your main method to kick it into action...

Here is the results:


...this is the two fogs that the example method fades between, you need to calibrate and rewrite the script to make it fit the mood of your map. Good luck!

Recent Changes Printable View Page History Edit Page [Attributes] [Printable View] [WikiHelp]
Page last modified on January 28, 2005, at 04:07 PM